package com.mobile.challenge.ui.report.unit.admin.adapter

import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.mobile.challenge.ui.report.adapter.IRefresh
import com.mobile.challenge.ui.report.model.PeriodType
import com.mobile.challenge.ui.report.unit.manager.weekmonth.ManagerLineFragment
import java.util.*

/**
 * @Author Touge
 * @Date 2020/9/16 21:22
 * @Description
 */
class ManagerMonthAdapter(fragment: Fragment) : FragmentStateAdapter(fragment),
        IRefresh {

    private var iRefresh: IRefresh? = null

    override fun getItemCount(): Int {
        return 1
    }

    override fun createFragment(position: Int): Fragment {
        iRefresh = ManagerLineFragment.newInstance(PeriodType.MONTH)
        return iRefresh as Fragment
    }

    override fun refresh(calendar: Calendar, period: Int) {
        iRefresh?.let {
            it.refresh(calendar, period)
        }
    }


}